
//对localStorage简单封装
const set = (key, value) => {
    if (!key || !value) {
        throw Error('key或者value是必传的')
    }
    localStorage.setItem(key, JSON.stringify(value))
}
//获取的
const get = (key) => {
    if (key) {
        let res = localStorage.getItem(key)
        res = JSON.parse(res)
        return res
    } else {
        throw Error('key是必传的')
    }
}
//移除的
const rm = (key) => {
    localStorage.removeItem(key)
}

export default {
    set,
    get,
    rm
}